import http from '@/plugins/axios'
let getPipe = (params) => http.get('/pipeType') // 获取经营范围

let getEnterPipe = (params) => http.get('/match/pipeType/enterpriseBusinessScope') // 获取企业经营范围

let getMaterial = (id) => http.get('/match/material', { // 根据产品分类查询材质
  params: {
    pipeTypeId: id
  }
})

let getStandard = (pipeTypeId, materialId) => http.get('/standard', { // 根据产品分类,材质查询标准
  params: {
    pipeTypeId: pipeTypeId,
    materialId: materialId
  }
})

let getMaterialList = () => http.get('/material') // 查询所有材质

let postUpgrade = (data) => http.post('/match/enterprise', data) // 提交升级企业账号申请

let isCheck = (params) => http.get('/match/user/isExistNotyetCheck') // 查询用户账号是否有待审核

let getEnterprise = (params) => http.get('/match/user/enterprise') // 企业账号信息展示

let editEnterprise = (id, data) => http({ // 编辑企业信息
  url: '/match/enterprise/' + id,
  method: 'put',
  data
})

let getProvince = () => http.get('/provincial') // 获取省份

let getCity = (id) => http.get('/city', { // 获取城市
  params: {
    provincialId: id
  }
})

let getAddress = (id) => http.get('/enterpriseWarehouseAddress/getByOrgId', { // 企业下的仓库地址
  params: {
    orgId: id
  }
})

let getGc = () => http.get('/org/selectByType', {
  params: {
    type: 'GC'
  }
})

let addSupply = (data) => http.post('/supply', data) // 发布供应信息

let editSupply = (data) => http.put('/supply', data) // 编辑供应信息

let getSupply = (params) => http.get('/supply', { // 获取个人发布供应
  params: params
})

let supplyDetail = (id) => http.get('/supply/' + id) // 获发布供应详情

let delSupply = (id) => http.delete('/supply/' + id) // 删除供应

let getCompany = (name) => http.get('/match/enterprise', {
  params: {
    name: name
  }
}) // 模糊搜索企业

let upgrade = (data) => http.post('/match/enterprise/upgrade', data) // 升级企业子账号
export default {
  getPipe,
  getEnterPipe,
  getMaterial,
  getMaterialList,
  getStandard,
  postUpgrade,
  isCheck,
  getEnterprise,
  editEnterprise,
  getProvince,
  getCity,
  getAddress,
  getGc,
  addSupply,
  editSupply,
  getSupply,
  supplyDetail,
  delSupply,
  getCompany,
  upgrade
}
